import request from '@/utils/request'

//获取商品分类
export  function findByParent(parentId) {
    return request({
      url: `/goods/cat/findByParent?parentId=${parentId}`,
      method: 'get',
    })
}


//根据分类id获取模板信息
export  function findTmpByCatId(catId) {
    return request({
      url: `/tmp/findTmptByCid?catId=${catId}`,
      method: 'get',
    })
}


//根据模板id获取规格和规格选项
export  function findSpecAndOptionByTid(tid) {
    return request({
      url: `/goods-spec/findSpecAndOptionsByTid?tid=${tid}`,
      method: 'get',
    })
}

//保存商品信息
export  function saveGoods(data) {
    return request({
      url: '/goods/save',
      method: 'post',
      data   //只能是data
    })
  } 
//查询
export function search(data){
  return request({
    url:'/goods/search',
    method:'post',
    data
  })
}  
//删除
export function delOne(data) {
  return request({
    url:'/goods/delById',
    method:'post',
    data
  })
}